cmake_minimum_required(VERSION 3.5)
project(airsim_target_point)

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

# 查找 ROS 2 所需包
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)

# 包含头文件目录
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(/usr/include/eigen3)
# 定义可执行文件
add_executable(target_point_node
  src/target_point.cpp
  src/client.cpp  # 将 client.cpp 作为依赖文件添加
)

# 添加依赖库
ament_target_dependencies(target_point_node
  rclcpp
  std_msgs
  sensor_msgs
  geometry_msgs
)

# 安装可执行文件
install(TARGETS target_point_node
  DESTINATION lib/${PROJECT_NAME}
)

# 安装 config 文件夹
install(DIRECTORY config/
  DESTINATION share/${PROJECT_NAME}/config
)

# 安装启动文件
install(DIRECTORY launch
  DESTINATION share/${PROJECT_NAME}/
)

# 获取工作空间路径
get_filename_component(workspace_path ${CMAKE_SOURCE_DIR} DIRECTORY)
set(SRC_PATH "${workspace_path}/airsim_target_point")

# 将路径作为定义传递给源代码
add_definitions(-DSRC_PATH="${SRC_PATH}")

ament_package()
